package com.ie.cloud.payment.controller;

import com.ie.cloud.payment.config.aop.MethodLog;
import com.ie.cloud.payment.service.impl.NoticeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * Created with FR
 *
 * @Author: DQ
 * @Date: 2025/07/18/11:05
 * @Description: 描述语句
 */
@Tag(name = "回调通知")
@Controller
@RequestMapping("/api/callback")
@Validated
@Slf4j
public class NoticeController extends HttpServlet {

    @Resource
    private NoticeService noticeService;

    @Operation(summary = "测试推送")
    @PostMapping("/call-test")
    @MethodLog(remark = "测试推送")
    public  void identityCheck(HttpServletRequest request) {


        log.info("----------接收到推送 测试推送----------");

        String header = request.getHeader("msg");

        log.info("msg {}" , header);

    }

    @PostMapping(value = "/call")
    @ResponseBody
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
        noticeService.verifySign(req, resp);
    }
}
